package com.yaoli.niuke;

import java.util.Scanner;

/**
 * Created by siemens on 6/1/2017.
 */
public class _020_Test {

    public static void main(String [] args){
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();

        int product = 0;

        int count = 0;

        while(num >= 10){
            char sets[] = String.valueOf(num).toCharArray();
            product = 1;
            for(int i = 0 ; i < sets.length ; i++){
                product = product * Integer.valueOf(String.valueOf(sets[i]));
            }
            num = product;
            count++;
        }

        System.out.println(count);
    }
}
